const { default: axios } = require("axios");
const { getDewuQueryStr, dewuHeaders } = require("../../tools");
// const sign = require("../../tools/sign");

/**
 * Dewu-API根据关键字搜索产品信息
 * @param {import("koa").Context} ctx  - 路由上下文
 */
module.exports = async(ctx) => {
    let headers = dewuHeaders();
    let { title, pageNum, pageSize } = ctx.request.query;
    const queryStr = getDewuQueryStr({
        title: title || "aj",
        page: pageNum || 0,
        limit: pageSize || 20,
        showHot: -1,
        sortType: 1,
        sortMode: 1,
        unionId: "",
    });
    let result = await axios.get(`https://app.poizon.com/api/v1/h5/search/fire/search/list?${queryStr}`, {
        headers
    });
    ctx.body = result.data.data
}